package com.geek.base.ch02.videodemo;



/*
 *@Date 2025/11/8
 *@Author wangpeng
 *@Description TODO
 */
public class SwitchTest2 {
    public static void main(String[] args) {
        //switch(表达式) 整型：byte short int 字符型：char  枚举：JDK1.5Enum  字符串：JDK1.7String
        char c = 'a';
        //一旦未遇到break跳出，则直接击穿
        switch (c) {
            case 'a':
            case 'b':
                System.out.println("a");
            case 'c':
                System.out.println("c");
                break;
            default:
                System.out.println("default");
        }


        System.out.println("-------------------------");
        MyEnum instance = MyEnum.getInstance();
        switch (instance){
            case WOMAN:
                System.out.println("女");
                break;
            case MAN:
                System.out.println("男");
                break;
        }
    }
}
